//
//  LoadingView.m
//  blackjack
//
//  Created by Thi Nguyen Tran on 3/13/10.
//  Copyright 2010 Epsilon. All rights reserved.
//

#import "LoadingView.h"


@implementation LoadingView

@synthesize delegate;

- (id)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
		self.image = [UIImage imageNamed:@"loading_background.png"];
		[self setUserInteractionEnabled:YES];		
		
		//loading bar
		UIImage *loadingBarImg = [UIImage imageNamed:@"loading_progressbar_empty.png"];
		UIImageView *loadingBar = [[UIImageView alloc] initWithFrame:CGRectMake(50, 360, loadingBarImg.size.width, loadingBarImg.size.height)];
		[loadingBar setImage:loadingBarImg];
		[self addSubview:loadingBar];
		[loadingBar release];
		
		//loading text
		UIImage *loadingTextImg = [UIImage imageNamed:@"loading_text.png"];
		UIImageView *loadingText = [[UIImageView alloc] initWithFrame:CGRectMake(120, 360, loadingTextImg.size.width, loadingTextImg.size.height)];
		[loadingText setImage:loadingTextImg];
		[self addSubview:loadingText];
		//[self bringSubviewToFront:loadingText];
		[loadingText release];
    }
    return self;
}


- (void)touchesEnded:(NSSet *)touches 
		   withEvent:(UIEvent *)event {
	NSLog(@"touched loading");
	[delegate touchedLoadingView];
}

- (void)dealloc {
    [super dealloc];
}


@end
